package org.rcy.ruicingmarket.controller;

import org.rcy.framework.api.entity.ResultMessage;
import org.rcy.framework.api.sms.SMSTemplate;
import org.rcy.ruicingmarket.client.MessageClient;
import org.rcy.ruicingmarket.service.MessageService;
import org.rcy.ruicingmarket.vo.SMSParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 吴康桥
 * @Description
 * @date 2022/11/24 9:26
 */

@RestController
@RequestMapping("/message")
public class MessageController implements MessageClient {

	private Logger logger = LoggerFactory.getLogger(getClass());

	@Autowired
	private MessageService messageService;

	@Override
	@PostMapping("/sendsms")
	public ResultMessage sendSMS(@RequestBody SMSParam param) {
		try {
			messageService.sendSms(param);
			return ResultMessage.success();
		} catch (Exception e) {

		}
		return ResultMessage.error();
	}
}
